package com.study.webapp.leetcode;

/**
 * 每次调用getInstance都需要synchronized同步，效率较低
 */
public class Singleton1 {

    private static Singleton1 instance;
    private Singleton1() {

    }

    public static synchronized Singleton1 getInstance() {
        if (instance == null) {
            instance = new Singleton1();
        }
        return instance;
    }
}
